package com.iretailer.quartz.common;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Job 有状态实现类，不允许并发执行
 *        若一个方法一次执行不完下次轮转是则等待该方法执行完后才执行下一次操作
 *        主要通过注解： @DisallowConcurrentExecution  
 * @author Administrator
 *
 */


@DisallowConcurrentExecution  
public class QuartzJobFactoryDisallowConcurrentExecution implements Job{

	private Logger log = LoggerFactory.getLogger(QuartzJobFactoryDisallowConcurrentExecution.class);
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
        QuartzJobBean scheduleJob = (QuartzJobBean)context.getMergedJobDataMap().get("scheduleJob");
//        log.warn("[" + scheduleJob.getJobName() + "] 执行成功");     
        TaskUtils.invokMethod(scheduleJob);  
		
	}

}
